package com.naiterui.ehp.bs.doctor.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.doctor.exception.ExceptionCodes;
import com.naiterui.ehp.bs.doctor.service.IStorageService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.apache.commons.fileupload.FileUploadException;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author gaoliangliang
 * @date 2020/12/28 下午1:14
 **/
@RequiredArgsConstructor
@RestController
@RequestMapping("ad/inner/cms")
@Api(tags = {SwaggerTag.DOCTOR + SwaggerTag.INNER_API + SwaggerTag.OTHER})
//TODO 确定还使用么
public class AdInnerCmsController {

    private final IStorageService bannerService;

    @PutMapping("file")
    public ResponseVO<Void> editBanner(String title, MultipartFile file) throws FileUploadException {
        bannerService.updateById(title, file);
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS);
    }
}
